home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / boot / initrd.img-2.6.28-15-generic / initrd.img-2.6 / scripts / casper-bottom / 10adduser < prev    next >
Encoding:
Text File  |  2009-10-12  |  4.1 KB  |  117 lines

  1. #!/bin/sh
  2.  
  3. PREREQ=""
  4. DESCRIPTION="Adding live session user..."
  5.  
  6. . /scripts/casper-functions
  7.  
  8. prereqs()
  9. {
  10.        echo "$PREREQ"
  11. }
  12.  
  13. case $1 in
  14. # get pre-requisites
  15. prereqs)
  16.        prereqs
  17.        exit 0
  18.        ;;
  19. esac
  20.  
  21. log_begin_msg "$DESCRIPTION"
  22.  
  23. # U6aMy0wojraho is just a blank password
  24. chroot /root debconf-communicate -fnoninteractive casper > /dev/null <<EOF
  25. set passwd/root-password-crypted *
  26. set passwd/user-password-crypted U6aMy0wojraho
  27. set passwd/user-fullname $USERFULLNAME 
  28. set passwd/username $USERNAME
  29. set passwd/user-uid 999
  30. EOF
  31.  
  32. chroot /root /usr/lib/user-setup/user-setup-apply > /dev/null
  33.  
  34. # Clear out debconf database again to avoid confusing ubiquity later.
  35. chroot /root debconf-communicate -fnoninteractive casper > /dev/null <<EOF
  36. set passwd/root-password-crypted
  37. set passwd/user-password-crypted
  38. set passwd/user-fullname
  39. set passwd/username
  40. set passwd/user-uid
  41. EOF
  42.  
  43. if [ -f /root/etc/sudoers ]; then
  44.     if [ "${BUILD_SYSTEM}" = "Ubuntu" ]; then
  45.     if grep -q '^%admin' /root/etc/sudoers; then
  46.         sed -i -e '/^%admin/s/(ALL) ALL$/(ALL) NOPASSWD: ALL/' /root/etc/sudoers
  47.     else
  48.         echo '%admin  ALL=(ALL) NOPASSWD: ALL' >> /root/etc/sudoers
  49.     fi
  50.     elif [ "${BUILD_SYSTEM}" = "Debian" ]; then
  51.         echo "${USERNAME}  ALL=(ALL) NOPASSWD: ALL" >> /root/etc/sudoers
  52.     fi
  53. fi
  54.  
  55. # XXX - awful hack to stop xscreensaver locking the screen (#7150)
  56. echo 'RUNNING_UNDER_GDM="yes"' >> /root/etc/environment
  57.  
  58. for file in /usr/share/applications/ubiquity-gtkui.desktop /usr/share/applications/kde/ubiquity-kdeui.desktop; do
  59.     if [ -f "/root/$file" ]; then
  60.         chroot /root install -d -o $USERNAME -g $USERNAME /home/$USERNAME/Desktop
  61.         chroot /root install -D -o $USERNAME -g $USERNAME $file /home/$USERNAME/Desktop/$(basename "$file")
  62.         break
  63.     fi
  64. done
  65.  
  66. if [ -L /root/home/$USERNAME/Examples ]; then
  67.     chroot /root install -o $USERNAME -g $USERNAME -d /home/$USERNAME/Desktop/
  68.     mv /root/home/$USERNAME/Examples /root/home/$USERNAME/Desktop/
  69. fi
  70.  
  71. if [ -f /root/home/$USERNAME/examples.desktop ]; then
  72.     chroot /root install -o $USERNAME -g $USERNAME -d /home/$USERNAME/Desktop/
  73.     mv /root/home/$USERNAME/examples.desktop /root/home/$USERNAME/Desktop/
  74. fi
  75.  
  76. #Kubuntu
  77. if [ -f "/root/usr/bin/plasma" ]; then
  78.     if [ -f "/root/usr/share/kde4/apps/khelpcenter/plugins/kubuntu/about-kubuntu.desktop" ]; then
  79.       chroot /root install -d -o $USERNAME -g $USERNAME /home/$USERNAME/Desktop
  80.       chroot /root install -D -o $USERNAME -g $USERNAME /usr/share/kde4/apps/khelpcenter/plugins/kubuntu/about-kubuntu.desktop /home/$USERNAME/Desktop/about-kubuntu.desktop
  81.     fi
  82. fi
  83.  
  84. #Ubuntu MID wants to be installed with --automatic
  85. if [ -f "/root/usr/share/ubuntu-mid-default-settings/mid-gui-start" ]; then
  86.   if [ -f "/root/usr/share/applications/ubiquity-gtkui.desktop" ]; then
  87.     sed -i 's/--desktop/--automatic --desktop/' "/root/usr/share/applications/ubiquity-gtkui.desktop"
  88.   fi
  89. fi
  90.  
  91. #Ubuntu MID uses kourou, and the ubiquity icon should be easy to find
  92. if [ -f "/root/usr/lib/hildon-desktop/kourou.py" ]; then
  93.   if [ -f "/root/etc/xdg/menus/home.menu" ]; then
  94.     sed -i '/<\/Include>/i\        <Filename>ubiquity-gtkui.desktop</Filename>' "/root/etc/xdg/menus/home.menu"
  95.   fi
  96. fi
  97.  
  98. #Ubuntu Netbook Remix needs Categories=Favorites for ubiquity
  99. if grep -q "Categories=Favorites;" "/root/usr/share/applications/firefox-fav.desktop"; then
  100.   if [ -f "/root/usr/share/applications/ubiquity-gtkui.desktop" ]; then
  101.     sed -i '/^Categories/s/$/Favorites;/' "/root/usr/share/applications/ubiquity-gtkui.desktop"
  102.   fi
  103. fi
  104.  
  105. #Mythbuntu
  106. if [ -d "/root/usr/share/mythbuntu" ]; then
  107.   if [ -f "/root/usr/share/applications/mythbuntu-live-frontend.desktop" ]; then
  108.     chroot /root install -d -o $USERNAME -g $USERNAME /home/$USERNAME/Desktop
  109.     chroot /root install -D -o $USERNAME -g $USERNAME /usr/share/applications/mythbuntu-live-frontend.desktop /home/$USERNAME/Desktop/mythbuntu-live-frontend.desktop
  110.   fi
  111.   if [ -f "/root/etc/xdg/mythbuntu/xfce4/mcs_settings/desktop.xml" ]; then
  112.     sed -i "s/<\/mcs/\t<option\ name=\"showremovable\"\ type=\"int\"\ value=\"0\"\/>\n<\/mcs/" /root/etc/xdg/mythbuntu/xfce4/mcs_settings/desktop.xml 
  113.   fi
  114. fi
  115.  
  116. log_end_msg
  117.